
#include <vector>

using namespace std;

#include "alvopp.hxx"
AlvoPP psr;

struct AlvoPP_Private {
	vector<A_CONT_TAG*> stack;  //XX1123
};

void AlvoPP::print() {
	vector<A_CONT_TAG*>::iterator sii=stack.begin(), sie=stack.end(); //XX1123
	while (sii!=sie) {
		cout << *sii << endl;
		++sii;
	}
}

#if 1

void push_back(int a, int b);
void stack_back(int a);
void pop_back(int a);

void AlvoPP::sg() {push_back(prv.stack,cur);cur=C.group();}
void AlvoPP::sl() {push_back(prv.stack,cur);cur=C.list();}
void AlvoPP::sz() {push_back(prv.stack,cur);cur=C.lazy();}
void AlvoPP::eg() {cur=stack_back(prv.stack);pop_back(prv.stack);}
void AlvoPP::el() {cur=stack_back(prv.stack);pop_back(prv.stack);}
void AlvoPP::ez() {cur=stack_back(prv.stack);pop_back(prv.stack);}
void AlvoPP::numeric()    {LexName(nn, sizeof(nn));A_INT  *aa=C.int_       (*&nn, X.cont(*cur));}
void AlvoPP::stringular() {LexName(nn, sizeof(nn));A_STR  *aa=C.stringular (*&nn, X.cont(*cur));}
void AlvoPP::eval()       {ev=1;}//LexName(nn, sizeof(nn));A_EVAL *aa=C.eval       (*&nn, X.cont(*cur));}
void AlvoPP::symbol() {
	LexName(nn, sizeof(nn));
	if (ev==0)
		C.symbol(nn, X.cont(*cur));
	else 
		C.eval(*&nn, X.cont(*cur));
	ev=0;
}
#else
#include <iostream>

int ii=0;
void ind() {int i=ii;cout<<endl;while(i--) cout << " "; }

void AlvoPP::sg() {cout << "( ";ii++; }
void AlvoPP::sl() {cout << "[ ";ii++; }
void AlvoPP::sz() {cout << "{ ";ii++; }
void AlvoPP::eg() {cout << ")";ii--,ind(); }
void AlvoPP::el() {cout << "]";ii--,ind(); }
void AlvoPP::ez() {cout << "}";ii--,ind(); }
void AlvoPP::numeric()    {LexName(nn, sizeof(nn));cout << nn << ' '; }
void AlvoPP::stringular() {LexName(nn, sizeof(nn));cout << '"' << nn << '"'  << endl; }
void AlvoPP::eval()       {ev=1;}//LexName(nn, sizeof(nn));A_EVAL *aa=C.eval       (*&nn, X.cont(*cur));}
void AlvoPP::symbol() {
	LexName(nn, sizeof(nn));
	if (ev==0)
		cout << nn;
	else {
		cout << '/' << nn;
	}
	ev=0;
	cout << '\t';
}
#endif
